const express = require("express");

const router = express.Router();

const expressJoi = require("@escook/express-joi")

const shoppingCartHandler = require("../router_handler/shoppingCart")

const { add_cart_schema, update_amount_schema, remove_cart_schema } = require("../schema/shoppingCart");



// 加入购物车路由
router.post("/addToCart", expressJoi(add_cart_schema), shoppingCartHandler.addToCart);

router.get("/getCart", shoppingCartHandler.getCart);

router.post("/upAmount", expressJoi(update_amount_schema), shoppingCartHandler.upAmount);

router.post("/removeCart", expressJoi(remove_cart_schema), shoppingCartHandler.removeCart);

router.get("/getLen", shoppingCartHandler.getLen)

module.exports = router;